package com.mall.seckill.converter;

import com.mall.seckill.dal.entitys.PromoItem;
import com.mall.seckill.dto.ProductItem;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author lichao
 * @createdate 2021-01-29 15:27
 */

@Mapper(componentModel = "spring")
public interface PromoItemConverter {
    @Mappings({@Mapping(source = "itemId",target = "id"),
                @Mapping(source = "itemStock",target = "inventory"),
                @Mapping(source = "seckillPrice",target = "seckillPrice"),
                @Mapping(target = "picUrl",ignore = true),
                @Mapping(target = "productName",ignore = true)
    })
    ProductItem promoItem2Dto(PromoItem promoItem);

    List<ProductItem> promoItem2Dto(List<PromoItem> promoItems);

}
